import socket

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(("127.0.0.1", 9999))
# 同一时刻 ，允许多少客户端跟我通信
server.listen(5)
print("服务端已启动，等待客户端连接=======》")
client, address = server.accept()
print("客户端已经连接")

while True:
    recv = client.recv(1024)
    msg = recv.decode("utf-8")
    if msg == "close":
        print("服务端关闭=======》")
        server.close()
        break
    print("客户端发送的内容:", msg)
    print("请输入回复内容：")
    client.send(input().encode("utf-8"))
